package com.za.wbw.web.wap.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;

import com.za.wbw.model.wap.vo.CommentListVo;
import com.za.wbw.service.wap.CommentService;
import com.za.wbw.util.BaseAction;

public class CommentAction extends BaseAction {
	private static final long serialVersionUID = 1L;
	
	private CommentService commentService;

	public String queryCommentPage() throws Exception{
		Map<String, Object> map = new HashMap<String, Object>();
		int count = this.getCommentService().queryCommentCount();
		map.put("comment_count", count);
		List<CommentListVo> commentVos = this.getCommentService().queryCommentList(0);
		map.put("comment_list", commentVos);
		JSONArray json = JSONArray.fromObject(map);
		outPrint(json);
		return null;
	}

	public CommentService getCommentService() {
		return commentService;
	}

	public void setCommentService(CommentService commentService) {
		this.commentService = commentService;
	}
}